﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace StarForce {
    public class UiMotionScaleCard : UiMotionBaseCard
    {
        public UiMotionScaleCard(Card handler) : base(handler) {
        }

        protected override bool CheckFinslState() {
            var delta = Target - Handler.transform.localScale;
            return delta.magnitude <= Threshold;
        }

        protected override void KeepMotion() {
            var current = Handler.transform.localScale;
            var amount = Time.deltaTime * Speed;
            Handler.transform.localScale = Vector3.Lerp(current, Target, amount);
        }

        protected override void OnMotionEnds() {
            Handler.transform.localScale = Target;
            IsOperating = false;
            base.OnMotionEnds();
        }
    }
}
